#ifndef INCLUDED_ZIPFILE_H
#define INCLUDED_ZIPFILE_H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#ifdef __cplusplus
extern  "C" {
#endif

typedef struct zipfile_entry_t
{
	char* filename;
	unsigned int offset;
} zipfile_entry_t;

typedef struct zipfile_t
{
	FILE* fp;
	int nfiles;
	zipfile_entry_t* entries;
} zipfile_t;


zipfile_t* zipfile_init(const char* filename);
void zipfile_done(zipfile_t* zipfile);

/* You *must* free the returned pointer yourself */
void* zipfile_slorp(zipfile_t* zipfile, const char* filename, unsigned int* length);
void* file_slorp(const char* filename, unsigned int* length);

#ifdef __cplusplus
}
#endif
#endif /* INCLUDED_ZIPFILE_H */


